<cfcomponent displayname="cfc" output="false">
		<cfproperty name="CategoryID" type="numeric" default="" />
		<cfproperty name="CategoryName" type="string" default="" />
		<cfproperty name="CategoryBGColor" type="string" default="" />
		<cfproperty name="CategoryTextColor" type="string" default="" />
		<cfproperty name="View" type="string" default="" />
		<cfproperty name="LinkDate" type="string" default="" />
		<cfproperty name="AppAction" type="string" default="" />
		
		
	<!---
	PROPERTIES
	--->
	<cfset variables.instance = StructNew() />

	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" returntype="CategoryBean" output="false">
		<cfargument name="CategoryID" type="string" default="" />
		<cfargument name="CategoryName" type="string" default="" />
		<cfargument name="CategoryBGColor" type="string" default="" />
		<cfargument name="CategoryTextColor" type="string" default="" />
		<cfargument name="View" type="string" default="" />
		<cfargument name="LinkDate" type="string" default="" />
		<cfargument name="AppAction" type="string" default="" />
		
		<!--- run setters --->
		<cfset setCategoryID(arguments.CategoryID) />
		<cfset setCategoryName(arguments.CategoryName) />
		<cfset setCategoryBGColor(arguments.CategoryBGColor) />
		<cfset setCategoryTextColor(arguments.CategoryTextColor) />
		<cfset setView(arguments.View) />
		<cfset setLinkDate(arguments.LinkDate) />
		<cfset setAppAction(arguments.AppAction) />
		
		<cfreturn this />
 	</cffunction>

	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="setMemento" access="public" returntype="CategoryBean" output="false">
		<cfargument name="memento" type="struct" required="yes"/>
		<cfset variables.instance = arguments.memento />
		<cfreturn this />
	</cffunction>
	<cffunction name="getMemento" access="public" returntype="struct" output="false" >
		<cfreturn variables.instance />
	</cffunction>

	<cffunction name="validate" access="public" returntype="array" output="false">
		<cfset var errors = arrayNew(1) />
		<cfset var thisError = structNew() />
		
		<!--- CategoryID --->
		<cfif (len(trim(getCategoryID())) AND NOT isNumeric(trim(getCategoryID())))>
			<cfset thisError.field = "CategoryID" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "CategoryID is not numeric" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- CategoryName --->
		<cfif (NOT len(trim(getCategoryName())))>
			<cfset thisError.field = "CategoryName" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "CategoryName is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getCategoryName())) AND NOT IsSimpleValue(trim(getCategoryName())))>
			<cfset thisError.field = "CategoryName" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "CategoryName is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getCategoryName())) GT 50)>
			<cfset thisError.field = "CategoryName" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "CategoryName is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- CategoryBGColor --->
		<cfif (len(trim(getCategoryBGColor())) AND NOT IsSimpleValue(trim(getCategoryBGColor())))>
			<cfset thisError.field = "CategoryBGColor" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "CategoryBGColor is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getCategoryBGColor())) GT 7)>
			<cfset thisError.field = "CategoryBGColor" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "CategoryBGColor is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- CategoryTextColor --->
		<cfif (len(trim(getCategoryTextColor())) AND NOT IsSimpleValue(trim(getCategoryTextColor())))>
			<cfset thisError.field = "CategoryTextColor" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "CategoryTextColor is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getCategoryTextColor())) GT 7)>
			<cfset thisError.field = "CategoryTextColor" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "CategoryTextColor is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<cfreturn errors />
	</cffunction>

	<!---
	ACCESSORS
	--->
	<cffunction name="setCategoryID" access="public" returntype="void" output="false">
		<cfargument name="CategoryID" type="string" required="true" />
		<cfset variables.instance.CategoryID = arguments.CategoryID />
	</cffunction>
	<cffunction name="getCategoryID" access="public" returntype="string" output="false">
		<cfreturn variables.instance.CategoryID />
	</cffunction>

	<cffunction name="setCategoryName" access="public" returntype="void" output="false">
		<cfargument name="CategoryName" type="string" required="true" />
		<cfset variables.instance.CategoryName = arguments.CategoryName />
	</cffunction>
	<cffunction name="getCategoryName" access="public" returntype="string" output="false">
		<cfreturn variables.instance.CategoryName />
	</cffunction>

	<cffunction name="setCategoryBGColor" access="public" returntype="void" output="false">
		<cfargument name="CategoryBGColor" type="string" required="true" />
		<cfset variables.instance.CategoryBGColor = arguments.CategoryBGColor />
	</cffunction>
	<cffunction name="getCategoryBGColor" access="public" returntype="string" output="false">
		<cfreturn variables.instance.CategoryBGColor />
	</cffunction>

	<cffunction name="setCategoryTextColor" access="public" returntype="void" output="false">
		<cfargument name="CategoryTextColor" type="string" required="true" />
		<cfset variables.instance.CategoryTextColor = arguments.CategoryTextColor />
	</cffunction>
	<cffunction name="getCategoryTextColor" access="public" returntype="string" output="false">
		<cfreturn variables.instance.CategoryTextColor />
	</cffunction>

	<cffunction name="getView" access="public" output="false" returntype="string">
		<cfreturn variables.instance.View />
	</cffunction>
	
	<cffunction name="setView" access="public" output="false" returntype="void">
		<cfargument name="View" type="string" required="true" />
		<cfset variables.instance.View = arguments.View />
	</cffunction>
	
	<cffunction name="getLinkDate" access="public" output="false" returntype="string">
		<cfreturn variables.instance.LinkDate />
	</cffunction>
	
	<cffunction name="setLinkDate" access="public" output="false" returntype="void">
		<cfargument name="LinkDate" type="string" required="true" />
		<cfset variables.instance.LinkDate = arguments.LinkDate />
	</cffunction>	

	<cffunction name="getAppAction" access="public" output="false" returntype="string">
		<cfreturn variables.instance.AppAction />
	</cffunction>
	
	<cffunction name="setAppAction" access="public" output="false" returntype="void">
		<cfargument name="AppAction" type="string" required="true" />
		<cfset variables.instance.AppAction = arguments.AppAction />
	</cffunction>

	<!---
	DUMP
	--->
	<cffunction name="dump" access="public" output="true" return="void">
		<cfargument name="abort" type="boolean" default="false" />
		<cfdump var="#variables.instance#" />
		<cfif arguments.abort>
			<cfabort />
		</cfif>
	</cffunction>

</cfcomponent>